package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.domain.ResponseResult;
import com.example.domain.entity.News;
import com.example.domain.entity.Star;
import com.example.mapper.NewsMapper;
import com.example.mapper.StarMapper;
import com.example.service.StarService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zeer
 * @since 2023-04-30
 */
@Service
public class StarServiceImpl extends ServiceImpl<StarMapper, Star> implements StarService {

    @Autowired
    private StarMapper starMapper;

    @Override
    public ResponseResult selectByStar() {

        List<Map<String,Object>> list = starMapper.selectByStar();
        if(Objects.isNull(list))
            throw new RuntimeException("数据为空");

        return ResponseResult.okResult(list);
    }
}
